package com.example.module_home.dagger

import android.util.Log
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import javax.inject.Inject

class RemoteDataSource @Inject constructor(val apiService: ApiService) {
    val TAG = RemoteDataSource::class.simpleName.toString()

    fun fetchRemoteData() {
        try {
            apiService.fetchData().let {
                it.enqueue(object :Callback<Any>{
                    override fun onFailure(call: Call<Any>, t: Throwable) {

                    }

                    override fun onResponse(call: Call<Any>, response: Response<Any>) {
                        Log.e(TAG, "==${response.body().toString()}")

                    }
                })
            }
        } catch (e: Exception) {
            e.printStackTrace()
        }
    }
}